package com.wanmait.wanmarecruit.webController;

import com.github.pagehelper.PageInfo;
import com.wanmait.wanmarecruit.entity.City;
import com.wanmait.wanmarecruit.entity.Company;
import com.wanmait.wanmarecruit.service.CompanyService;
import com.wanmait.wanmarecruit.service.ConfigService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
@RequestMapping("web")
public class WebCompanyListController {
    @Resource
    private CompanyService companyService;
    @Resource
    private ConfigService configService;

    @RequestMapping("/personal/updateCompanyList")
    public ModelAndView updateCompanyList(Company company, City city,Integer search,Integer pageNum,Integer[] companySizeIds)
    {
        ModelAndView modelAndView = new ModelAndView();
        Integer pageSize = Integer.parseInt(configService.getByKeyword("company_paging_size").getConfigValue());
        modelAndView.addObject("pageInfo",companyService.selectCompaniesByCondition(company,city,search,companySizeIds,pageNum,pageSize));
        return modelAndView;
    }
}
